<?php

/**
 * 面向对象
 */
class Car{

    var $color;
    //构造方法
    function __construct($color = "green")
    {
        $this->color = $color;
    }
    function getColor(){
        return $this->color;
    }
}
function printColor($obj){
    foreach (get_object_vars($obj) as $prop => $val){
        echo "\t$prop = $val\n";
    }
}
//实体一个对象
$apple = new Car("red");
echo "\tapple: Properties\n";
echo printColor($apple);

/**
 * Class Father 继承
 */
class Father{
    function ripi(){
        echo "<br>";
        echo "日大女人";
    }

}
class Son extends Father{
    public function ripi()
    {
        echo "<br>";
        parent::ripi(); // TODO: Change the autogenerated stub
        echo "还要日小女人";

    }
}
$son = new Son();
$father = new Father();
$father->ripi();
$son->ripi();
/**
 * 接口
 */
interface Piaochang{
    function chinai();
}
class Boss implements  Piaochang{
    function chinai()
    {
        echo "老板也要吃奶奶";
        // TODO: Implement chinai() method.
    }
}
